<style>
    .layui-card:last-child {
        width: 95%;
        /* min-height: 1100px; */
        margin: 0 auto;
        margin-top: 32px;
        border-radius: 8px;
        padding: 0px 15px;
        box-sizing: border-box;
    }
    
    .layui-card-body {
        width: 96%;
        margin: 0 auto;
        margin-top: 50px;
        box-shadow: 0px 2px 6px 0px rgba(6, 185, 145, 0.2);
    }
    
    .sanbut {
        float: right;
        display: flex;
        justify-content: space-around;
        align-items: center;
        /* position: absolute;
        right: 0;
        top: 0; */
    }
    
    .threemin {
        width: 39%;
        margin: 13px 0px 12px 0;
        background-color: #F5F5F5;
        border-radius: 4px;
        float: left;
        padding: 10px 20px;
        box-sizing: border-box;
        min-height: 176px;
    }
    
    .threemax {
        width: 59%;
        background-color: #F5F5F5;
        border-radius: 4px;
        margin: 13px 0px 12px 0;
        float: right;
        padding: 10px 20px;
        box-sizing: border-box;
    }
    
    .threemaxpor {
        width: 33%;
        background-color: #F5F5F5;
        border-radius: 4px;
        /* margin: 13px 0px 12px 0; */
        padding: 10px 20px;
        box-sizing: border-box;
    }
    
    th {
        border: transparent !important;
    }
    
    tr {
        border-bottom: 1px solid #F5F5F5;
    }
    
    .layui-btn-danger {
        background-color: #F87C7E;
    }
    
    .aa {
        border-radius: 8px;
        background-color: #F5F5F5;
        padding-left: 10px;
        width: 200px;
    }
    
    .bb {
        background-color: #06B991;
        display: inline-block;
        width: 90px;
        height: 38px;
        line-height: 38px;
        padding: 0 18px;
        /* background-color: transparent; */
        color: #fff;
        white-space: nowrap;
        text-align: center;
        font-size: 14px;
        border: none;
        /* border-radius: 2px; */
        cursor: pointer;
        border-radius: 8px;
        /* border: 1px solid #DCDFE6; */
        margin-right: 10px;
    }
    
    .layui-btn {
        display: inline-block;
        min-width: 90px;
    }
    
    .cc {
        min-width: 190px;
        font-size: 15px;
    }
    
    .minbox {
        /* width: 300px; */
        margin: 14px 0;
        width: 100%;
    }
    
    .layui-layer-page .layui-layer-content {
        width: 360px;
    }
    
    .layui-table,
    .layui-table-view {
        margin: 4px 0;
    }
    
    .zuobiao {
        width: 100%;
        text-align: center;
        font-size: 22px;
        margin: 23px 0;
    }
    
    .xy {
        font-size: 18px;
        width: 100%;
        text-align: center;
        margin-top: 12px;
    }
    
    .xy>input {
        margin-left: 22.5px;
        border-radius: 8px;
        background-color: #F5F5F5;
        height: 24.5px;
        width: 162px;
        padding-left: 10px;
        border: none;
    }
    
    .put>input {
        margin-left: 5.5px;
        border-radius: 8px;
        background-color: #F5F5F5;
        height: 24.5px;
        width: 162px;
        padding-left: 10px;
        border: none;
    }
    
    .xy>input::placeholder {
        font-size: 15px;
    }
    
    .liangbut {
        margin-top: 29.5px;
        display: flex;
        justify-content: center;
        margin-bottom: 10px;
    }
    
    tr {
        border: 1px solid #F5F5F5;
    }
    /* .layui-tab-item {
        height: 500px;
    }
     */
    
    .layui-form-item {
        position: absolute;
        top: 0;
        width: 98%;
    }
    
    .layui-this {
        background-color: #06B991;
        color: #fff !important;
    }
    
    .layui-tab-title {
        border: none;
    }
    
    .layui-tab-title .layui-this:after {
        border: none;
    }
    
    .xian {
        width: 70%;
        height: 20px;
        margin: 24px auto;
        color: #06B991;
        font-size: 18px;
        text-align: center;
        line-height: 20px;
        background: url(https://njyyl.oss-cn-hangzhou.aliyuncs.com/images/xian.png?versionId=CAEQIRiBgICZl9Gu4RciIDk5ODA5OGY4Mzg5OTRkYWU5ZmVjNzllZTBiNGY0YmU5) no-repeat;
        background-size: 100%;
    }
    
    .list {
        width: 100%;
        margin: 0% 0 2% 0
    }
    
    .son {
        width: 100px;
        height: 100px;
        background: url(https://njyyl.oss-cn-hangzhou.aliyuncs.com/images/yuan.png?versionId=CAEQIRiBgMCSl9Gu4RciIDc1ODM2YjY1Mjk0MzQ5NWZhN2E3MzViZjVmM2IzNmY1) no-repeat;
        background-size: 100% 100%;
        /* line-height: 129px; */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        float: left;
        margin: 12px 12px 0 0;
        cursor: pointer;
    }
    
    .sonwc {
        width: 100px;
        height: 100px;
        background: url(https://njyyl.oss-cn-hangzhou.aliyuncs.com/images/yuan.png?versionId=CAEQIRiBgMCSl9Gu4RciIDc1ODM2YjY1Mjk0MzQ5NWZhN2E3MzViZjVmM2IzNmY1) no-repeat;
        background-size: 100% 100%;
        /* line-height: 129px; */
        text-align: center;
        float: left;
        margin: 12px 12px 0 0;
        cursor: pointer;
    }
    
    .dd {
        background-color: #FEA858;
    }
    /*二级菜单样式修改*/
    
    .baba li {
        border: 1px solid #F2F3F6;
        border-radius: 10px;
        color: black;
        display: inline-block;
        width: 80px;
        height: 38px;
        line-height: 38px;
        padding: 0 18px;
        white-space: nowrap;
        text-align: center;
        font-size: 14px;
        cursor: pointer;
        border-radius: 8px;
        margin-right: 8px;
    }
    
    .erzi li {
        background-color: white !important;
        color: black !important;
        border: 1px solid #F2F3F6;
        border-radius: 10px;
        display: inline-block;
        width: 60px;
        height: 30px;
        font-size: 14px;
        line-height: 30px;
        padding: 0 13px;
        white-space: nowrap;
        margin-right: 5px;
    }
    
    .erzi .layui-this {
        border: 1px solid #8DDFCC;
        color: #8DDFCC !important;
    }
    
    .cansu {
        width: 211px;
        height: 215px;
        background: url(https://njyyl.oss-cn-hangzhou.aliyuncs.com/images/kuang.png?versionId=CAEQIRiBgICmosG94RciIGJmYzIxMjBhMDg5MzQxODRhNDEwNWRkZTI3OTJhM2Vj) no-repeat;
        background-size: 100% 100%;
        margin-right: 12.5px;
        margin-bottom: 15px;
        float: left;
    }
    
    [v-cloak] {
        display: none;
    }
    
    .maxcansu {
        width: 433.75px;
        height: 124.4px;
        background: url(https://njyyl.oss-cn-hangzhou.aliyuncs.com/images/maxkuang.png?versionId=CAEQIRiBgIDY_qa.4RciIGNmYWQyYWNjZGFjYTRkMzA5N2IyY2UzNjQ2MWVlMmE3) no-repeat;
        background-size: 100% 100%;
        margin-right: 12.5px;
        margin-bottom: 15px;
        float: left;
    }
    
    .kuang {
        display: flex;
        justify-content: space-around;
        align-items: center;
        font-size: 15px;
        height: 30px;
    }
    
    .kuangall {
        padding: 15px;
    }
    
    .maxkuang {
        padding: 15px 10px;
    }
    
    .minput {
        width: 61px;
        background-color: #F5F5F5;
        border: 1px solid #DCDFE6;
        color: #06B991;
        text-align: center;
    }
    
    .bcby {
        width: 100%;
        text-align: center;
        margin: 50px 0;
    }
    
    .bian {
        box-shadow: 0px 2px 6px 0px rgba(6, 185, 145, 0.2);
    }
    
    .yiyy {
        position: absolute;
        background-color: #DCDFE6;
        width: 100%;
        height: 100%;
        opacity: 0.8;
    }
    
    th,
    td {
        text-align: center;
    }
    
    .layui-table th {
        font-weight: 100;
        color: black;
    }
    
    .leftbiao {
        width: 60%;
        margin: 12px 0 0 0;
        box-shadow: 0px 2px 6px 0px rgba(6, 185, 145, 0.2);
        padding-bottom: 10px;
        box-sizing: border-box;
        float: left;
    }
    
    .rightbiao {
        width: 36%;
        margin: 12px 0 0 0;
        box-shadow: 0px 2px 6px 0px rgba(6, 185, 145, 0.2);
        padding-bottom: 10px;
        box-sizing: border-box;
        float: right;
    }
    
    .dibulan {
        width: 90%;
        margin: 5px auto;
        font-size: 16px;
        border-radius: 4px;
        text-align: center;
        height: 46px !important;
    }
    
    .divhui {
        background-color: #F5F5F5;
        width: 221px;
        height: 46;
        float: left;
        margin-right: 12px;
        border-radius: 5px;
        margin-top: 10px;
    }
    
    .dibukg {
        position: relative;
        width: 10px;
        float: right;
        margin-right: 20px;
    }
    
    .zhuangtai {
        float: left;
        font-size: 15px;
        /* margin-right: 12px; */
    }
    
    .hdtext {
        width: 90%;
        margin: 0 auto;
        font-size: 4rem;
        font-weight: 600;
    }
    
    .tbodyf td,
    .tbodyf th {
        padding: 6.5px 15px !important;
        text-align: left;
        font-size: 4rem;
    }
    
    .tbodyf>tr>td {
        text-align: left !important;
    }
    
    .zttwoa {
        width: 60%;
        box-shadow: 0px 2px 6px 0px rgba(6, 185, 145, 0.2);
        margin: 23px 0px 0 0;
        padding: 10px 20px;
        box-sizing: border-box;
        border-radius: 8px;
        min-height: 257.281px;
        float: left;
    }
    
    .zttwob {
        width: 35%;
        box-shadow: 0px 2px 6px 0px rgba(6, 185, 145, 0.2);
        margin: 23px 12px 0 0;
        padding: 10px 20px;
        box-sizing: border-box;
        border-radius: 8px;
        float: right;
        min-height: 257.281px;
        /* position: relative; */
    }
    
    .yinyin {
        width: 100%;
        height: 100%;
        background-color: #F5F5F5;
        opacity: 0.5;
        position: absolute;
        top: 0;
        left: 0;
        display: none;
    }
    
    .twolefta {
        width: 100%;
        font-size: 4rem;
    }
    
    .twoleftb {
        width: 50%;
        font-size: 4rem;
        float: left;
    }
    
    .twoleftc {
        width: 40%;
        font-size: 4rem;
        float: left;
        height: 55px;
        padding-top: 7px;
    }
    
    .twoleftd {
        width: 60%;
        font-size: 4rem;
        float: right;
        height: 55px;
        padding-top: 7px;
    }
    
    .layui-form-switch {
        margin-top: 0;
    }
    
    .tworight {
        width: 100%;
        background-color: #F5F5F5;
        padding: 5px 10px;
        box-sizing: border-box;
    }
    /* .layui-table {
        width: 100%;
        background-color: #F5F5F5;
        color: #666;
    } */
    
    .ztthree {
        width: 100%;
        box-shadow: 0px 2px 6px 0px rgba(6, 185, 145, 0.2);
        padding: 10px 20px;
        box-sizing: border-box;
        border-radius: 4px;
        margin-top: 12px;
    }
    
    .fudong {
        display: flex;
        justify-content: space-between;
    }
    
    .shebeiall {
        border-radius: 8px;
        border: 1px solid #DCDFE6;
        text-align: center;
        font-size: 14px;
        padding: 0 18px;
        height: 38px;
        line-height: 38px;
        margin-right: 10px;
    }
    
    .layui-form-select .layui-input {
        border-radius: 8px;
        background-color: #F5F5F5;
    }
    
    .layui-card-header {
        line-height: 30px;
    }
    
    .clbh {
        height: 38px;
        line-height: 38px;
        float: left;
        margin-right: 10px;
    }
    
    .ka {
        width: 100%;
    }
    
    .kahao {
        width: 100%;
        font-size: 5rem;
        font-weight: 600;
        text-align: center;
        margin: 2% auto;
    }
    
    .duka {
        width: 40%;
        float: left;
        font-size: 4rem;
        text-align: right;
    }
    
    .tongxin {
        width: 40%;
        float: right;
        font-size: 4rem;
        text-align: left;
    }
    
    .yi {
        position: relative;
    }
    
    .juzhong {
        width: 100%;
        margin: 2% auto;
        text-align: center;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="layadmin-useradmin-formlist">
            <div class="layui-tab" id="app" v-cloak>

                <div style="clear: both;"></div>
                <!-- 加个50是为了看起来大家都在一个水平上，不会因为别人有二级菜单，就一会上一会下的，要是不想要可以去掉，因为二级的高度是40 -->
                <div class="layui-tab-content">
                    <div class="list">

                        <div class="juzhong">
                            <div class="clbh"> 车辆编号:</div>
                            <div class="layui-inline" style="float: left;">

                                <div class="layui-form-item">
                                    <div class="layui-input-inline">
                                        <select name="interest-search" class="soso" lay-filter="interest-search" lay-search style="background-color: #F5F5F5;">
                                                </select>
                                    </div>
                                </div>
                            </div>
                            <h1>运动控制</h1>
                        </div>
                        <div class="son" @mousedown="down(0)" @mouseup="up(0)" id="tingche">停车</div>
                        <div class="son" @mousedown="down(1)" @mouseup="up(1)" id="qianjing">前进</div>
                        <div class="son" @mousedown="down(2)" @mouseup="up(2)" id="houtui">后退</div>
                        <div class="son" @mousedown="down(3)" @mouseup="up(3)" id="zuoyi">左移</div>
                        <div class="son" @mousedown="down(4)" @mouseup="up(4)" id="youyi">右移</div>
                        <div class="son" @mousedown="down(5)" @mouseup="up(5)" id="zuozhuan">左前</div>
                        <div class="son" @mousedown="down(6)" @mouseup="up(6)" id="youzhuan">右前</div>
                        <div class="son" @mousedown="down(7)" @mouseup="up(7)" id="cdk">左后</div>
                        <div class="son" @mousedown="down(8)" @mouseup="up(8)" id="cdg">右后</div>
                        <div class="son" @mousedown="down(9)" @mouseup="up(9)" id="spt">逆时针旋转</div>
                        <div class="son" @mousedown="down(10)" @mouseup="up(10)" id="jpt">顺时针旋转</div>
                        <div style="clear: both;"></div>
                    </div>
                    <div class="yang">
                        <div class="list" style="float: left;width: 30%;">
                            <div class="juzhong">
                                <h1>复位控制</h1>
                            </div>
                            <div class="son" @mousedown="down(11)" @mouseup="up(11)" id="wuxiao">无效</div>
                            <div class="son" @mousedown="down(12)" @mouseup="up(12)" id="fuwei">强制复位</div>
                            <div style="clear: both;"></div>
                        </div>
                        <div class="list" style="float: left;width: 40%;">
                            <div class="juzhong">
                                <h1>任务控制</h1>
                            </div>
                            <div class="son" @mousedown="down(13)" @mouseup="up(13)" id="wuxiaoer">无效</div>
                            <div class="sonwc">
                                <div style="margin-top: 20px;" @mousedown="down(14)" @mouseup="up(14)" id="rwwc">
                                    <img style="width: 25px;height: 25px;" src="/start/layui/images/wancheng.png" alt="">
                                    <br> 任务完成
                                </div>

                            </div>
                            <div class="sonwc">
                                <div style="margin-top: 20px;" @mousedown="down(15)" @mouseup="up(15)" id="rwcz">
                                    <img style="width: 25px;height: 25px;" src="/start/layui/images/jinggao.png" alt="">
                                    <br> 任务重做
                                </div>

                            </div>
                            <div style="clear: both;"></div>
                        </div>
                        <div class="list" style="float: left;width: 30%;">
                            <div class="juzhong">
                                <h1>动作控制</h1>
                            </div>
                            <div class="son" @mousedown="down(16)" @mouseup="up(16)" id="tingzhi">停止</div>
                            <div class="son" @mousedown="down(17)" @mouseup="up(17)" id="chongdian">充电</div>
                            <div style="clear: both;"></div>
                        </div>
                    </div>
                    <div style="clear: both;"></div>
                </div>
            </div>

        </div>
    </div>
</div>
<!-- <script>
    function  holdDown()  {            
        console.log('按下事件')      
    }        
    function  holdUp()  {            
        alert('松开事件')
    }
</script> -->
<script src="/start/vue.js"></script>
<script src="/start/layui/lay/modules/jquery.js"></script>

<script>
    layui.use('useradmin', layui.factory('useradmin')).use(['admin', 'useradmin', 'table', "laypage", "layer", "element"], function() {
        var $ = layui.$,
            admin = layui.admin,
            view = layui.view,
            setter = layui.setter,
            table = layui.table,
            laypage = layui.laypage,
            element = layui.element,
            layer = layui.layer,
            form = layui.form;


        function resetSize() {
            var base = 16;
            var width = document.documentElement.clientWidth;
            var fontSize = 16 / 6000 * width;
            document.documentElement.style.fontSize = fontSize + 'px'
        }
        resetSize()
        window.onresize = resetSize


        form.render(null, 'layadmin-useradmin-formlist');
        form.on('checkbox(switchTest)', function(data) {　　
            console.log('打', data);　　 //打印当前选择的信息
            if (data.elem.checked) {　　　　　　 //判断当前多选框是选中还是取消选中
                alert('当前选中');
            }　　
            var value = data.value; //获取选中的value值
        });
        //监听搜索
        form.on('submit(LAY-user-back-search)', function(data) {
            var field = data.field;

            //执行重载
            table.reload('table-instance', {
                where: field
            });
        });

        var ws = new WebSocket(setter.request.web);
        // 判断是否连接成功，1成功，3不成功
        // 连接成功
        ws.onopen = function() {
            let dataa = {
                'method': "subscribe",
                'resource': [1]
            }
            ws.send(JSON.stringify(dataa))
        }

        new Vue({
            el: '#app',
            data: {
                info: [],
                infoII: [],
                infoIII: [],
                agvid: '',
                ctrlId: '',
                ctrlist: [],
                agvlist: [],
                itemdata: [], //用来存放下拉框当前选中的数据
                alldata: [], //用来存放所有的下拉框数据
            },
            //计算
            computed: {

            },
            //初始调用
            created() {
                //调速参数(查询)
                var that = this

                // 状态搜索
                admin.req({
                    url: setter.request.baseUrl + "agv-info/query",
                    data: JSON.stringify({}),
                    type: "POST",
                    dataType: "json",
                    contentType: "application/json;charset=UTF-8",
                    done: function(res) {
                        var aaa = res.info.length - 1

                        var html = "<option style='color:#e6e6e6;' value=''>请选择车辆编号</option>";
                        for (i = 0; i < res.info.length; i++) {
                            html += "<option selected = 'selected' name=" + res.info[i].ctrlid + " value=" + res.info[i].agvId + ">" + res.info[i].agvId + "</option>"
                            that.ctrlist.push(res.info[i].ctrlId)
                            that.agvlist.push(res.info[i].agvId)
                        }
                        that.alldata = res.info;
                        $(".soso").empty().append(html)
                        form.render('select'); //需要渲染一下

                        //把这个第一条数据放到
                        that.itemdata = res.info[aaa]
                        localStorage.setItem('agvid',  res.info[aaa].agvId)
                    },

                });
                // console.log('1', $(".soso").text())
                //事件下拉框数据发生变化时
                form.on('select(interest-search)', function(data) {
                    // 调用搜索函数
                    var data_val = data.value; //当前选中的数据

                    //获取当前下拉框的下标
                    var index = $(this).index();
                    //下标对应的alldata里面的数据,下标是从1开始的所有要-1，数组是从0开始的
                    that.itemdata = that.alldata[index - 1]
                        // console.log(that.alldata)
                    that.agvid = data.value
                    if (data_val == "") {
                        // 查询所有的数据,不传的时候就是查询所有的
                        getData('')
                    } else {
                        getData(data_val)
                    }
                    // console.log(data);
                    cansua()
                });
                getData('')
                cansua()

                function getData(agvId) {
                    table.render({
                        //接口
                        elem: "#LAY-app-message-all",
                        url: setter.request.baseUrl + "agv-info/query",
                        data: JSON.stringify({}),
                        where: {
                            agvId: agvId
                        },
                        contentType: "application/json;charset=UTF-8",
                        method: "POST",
                        response: {
                            statusName: "code",
                            statusCode: 0,
                            msgName: "msg",
                            countName: "totalCount",
                            dataName: "info",
                        },
                        page: false,
                        done: function(res, curr, count) {
                            console.log('w', res)
                            laypage.render({
                                elem: 'demo5',
                                count: res.pageResponseDTO.total,
                                curr: pageNum,
                                limit: 10,
                                jump: function(obj, first) {
                                    if (!first) {
                                        // that.shuju.pageNum = obj.curr;
                                        getData(obj.curr)
                                    }
                                }
                            });
                        },
                        cols: [
                            [{
                                field: "agvId",
                                title: "车辆编号",
                                align: 'center',
                                width: '10%',
                            }, {
                                field: "ctrlId",
                                title: "控制板编号",
                                align: 'center',
                                width: '10%',
                            }],
                        ],
                    });

                }
                $('#qianjing,#houtui,#zuoyi,#youyi,#zuozhuan,#youzhuan,#cdg,#spt,#jpt,#sfb,#cdk,#rwwc,#jfb').mousedown(function() {
                    console.log(123123)
                    this.style.color = 'red'
                })
                $('#qianjing,#houtui,#zuoyi,#youyi,#zuozhuan,#youzhuan,#cdg,#spt,#jpt,#sfb,#cdk,#rwwc,#jfb').mouseup(function() {
                    this.style.color = 'black'
                })
                $('#rwcz').mousedown(function() {
                    rwcz.style.color = 'black'
                })
                $('#rwcz').mouseup(function() {
                    rwcz.style.color = 'red'
                })

                function cansua() {
                    console.log('222', that.agvid)
                    console.log('333', that.ctrlId)
                    localStorage.setItem('agvid',  that.agvid)
                }

            },
            updated: function() {
                layui.use(['form'], function() {
                    form.render();
                })
            },
            methods: {
                down: function(data) {
                    var that = this;
                    switch (data) {
                        case 0:
                            $('#tingche').css('color', 'red')
                            break;
                        case 1:
                            $('#qianjing').css('color', 'red')
                            break;
                        case 2:
                            $('#houtui').css('color', 'red')
                            break;
                        case 3:
                            $('#zuoyi').css('color', 'red')
                            break;
                        case 4:
                            $('#youyi').css('color', 'red')
                            break;
                        case 5:
                            $('#zuoqian').css('color', 'red')
                            break;
                        case 6:
                            $('#youqian').css('color', 'red')
                            break;
                        case 7:
                            $('#cdk').css('color', 'red')
                            break;
                        case 8:
                            $('#cdg').css('color', 'red')
                            break;
                        case 9:
                            $('#spt').css('color', 'red')
                            break;
                        case 10:
                            $('#jpt').css('color', 'red')
                            break;
                        case 11:
                            $('#wuxiao').css('color', 'red')
                            break;
                        case 12:
                            $('#fuwei').css('color', 'red')
                            break;
                        case 13:
                            $('#wuxiaoer').css('color', 'red')
                            break;
                        case 14:
                            $('#rwwc').css('color', 'red')
                            break;
                        case 15:
                            $('#rwcz').css('color', 'red')
                            break;
                        case 16:
                            $('#tingzhi').css('color', 'red')
                            break;
                        case 17:
                            $('#chongdian').css('color', 'red')
                            break;
                    }
                    var agvid = localStorage.getItem('agvid')
                    let date = new Date();
                    let dateYear = date.getFullYear();
                    let dateMonth = date.getMonth() + 1;
                    let dateDate = date.getDate();
                    let dateHours = date.getHours();
                    let dateMinutes = date.getMinutes();
                    let dateSeconds = date.getSeconds();
                    console.log('按下事件')
                    console.log('这里可以拿数据', that.itemdata)
                    var a = 0,
                        b = 0,
                        c = 0,
                        d = 0
                    console.log('1122', data)
                    if (data < 11) {
                        a = data
                    } else if (data < 13) {
                        if (data == 11) {
                            b = 0
                        } else {
                            b = 1
                        }

                    } else if (data < 16) {
                        if (data == 13) {
                            c = 0
                        } else if (data == 14) {
                            c = 1
                        } else {
                            c = 2
                        }

                    } else {
                        if (data == 16) {
                            d = 0
                        } else {
                            d = 1
                        }
                    }
                    var arr = [a, b, d, c]
                    admin.req({
                        url: setter.request.baseUrl + "agv-control/add",
                        data: JSON.stringify({
                            agvId: parseInt(agvid),
                            actionCtrl: d, //动作控制
                            ctrlId: that.itemdata.ctrlId,
                            moveCtrl: a, //运动控制
                            taskCtrl: c, //任务控制
                            resetCtrl: b, //复位控制
                            savetime: dateYear + '-' + dateMonth + '-' + dateDate + ' ' + dateHours + ':' + dateMinutes + ':' + dateSeconds //时间
                        }),
                        type: "POST",
                        dataType: "json",
                        contentType: "application/json;charset=UTF-8",
                        done: function(res) {
                            layer.msg(res.msg);
                        },
                    });
                    console.log(a, b, c, d)
                    var data = {
                        "method": "put",
                        "EVENT": 8240,
                        "CTRLID": parseInt(that.itemdata.ctrlId),
                        "AGVID": parseInt(agvid),
                        "MSGBODY": [a, b, d, c]
                    }
                    ws.send(JSON.stringify(data))
                    console.log(JSON.stringify(data))

                },
                up: function(data) {
                    console.log("抬起")
                    var that = this;
                    switch (data) {
                        case 0:
                            $('#tingche').css('color', 'black')
                            break;
                        case 1:
                            $('#qianjing').css('color', 'black')
                            break;
                        case 2:
                            $('#houtui').css('color', 'black')
                            break;
                        case 3:
                            $('#zuoyi').css('color', 'black')
                            break;
                        case 4:
                            $('#youyi').css('color', 'black')
                            break;
                        case 5:
                            $('#zuoqian').css('color', 'black')
                            break;
                        case 6:
                            $('#youqian').css('color', 'black')
                            break;
                        case 7:
                            $('#cdk').css('color', 'black')
                            break;
                        case 8:
                            $('#cdg').css('color', 'black')
                            break;
                        case 9:
                            $('#spt').css('color', 'black')
                            break;
                        case 10:
                            $('#jpt').css('color', 'black')
                            break;
                        case 11:
                            $('#wuxiao').css('color', 'black')
                            break;
                        case 12:
                            $('#fuwei').css('color', 'black')
                            break;
                        case 13:
                            $('#wuxiaoer').css('color', 'black')
                            break;
                        case 14:
                            $('#rwwc').css('color', 'black')
                            break;
                        case 15:
                            $('#rwcz').css('color', 'black')
                            break;
                        case 16:
                            $('#tingzhi').css('color', 'black')
                            break;
                        case 17:
                            $('#chongdian').css('color', 'black')
                    }
                    var agvid = localStorage.getItem('agvid')
                    let date = new Date();
                    let dateYear = date.getFullYear();
                    let dateMonth = date.getMonth() + 1;
                    let dateDate = date.getDate();
                    let dateHours = date.getHours();
                    let dateMinutes = date.getMinutes();
                    let dateSeconds = date.getSeconds();
                    console.log('时间：', dateYear + '-' + dateMonth + '-' + dateDate + ' ' + dateHours + ':' + dateMinutes + ':' + dateSeconds)
                    console.log('按下事件')
                    console.log(data)
                    admin.req({
                        url: setter.request.baseUrl + "agv-control/add",
                        data: JSON.stringify({
                            agvId: parseInt(agvid),
                            actionCtrl: 0, //动作控制
                            ctrlId: that.itemdata.ctrlId,
                            moveCtrl: 0, //运动控制
                            taskCtrl: 0, //任务控制
                            resetCtrl: 0, //复位控制
                            savetime: dateYear + '-' + dateMonth + '-' + dateDate + ' ' + dateHours + ':' + dateMinutes + ':' + dateSeconds //时间
                        }),
                        type: "POST",
                        dataType: "json",
                        contentType: "application/json;charset=UTF-8",
                        done: function(res) {
                            layer.msg(res.msg);
                        },
                    });
                    var data = {
                        "method": "put",
                        "EVENT": 8240,
                        "CTRLID": parseInt(that.itemdata.ctrlId),
                        "AGVID": parseInt(agvid),
                        "MSGBODY": [0, 0, 0, 0]
                    }
                    ws.send(JSON.stringify(data))
                    console.log(JSON.stringify(data))
                },
                but: function onopen() {

                }
            }
        })

        $('.layui-btn.layuiadmin-btn-admin').on('click', function() {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });

        $('#two2').click(function() {
            $('#two2').attr('checked')
        })
    });
    //远程控制
</script>